package com.financing.wap.dao.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import com.financing.wap.common.SqlName;
import com.financing.wap.common.SqlName.FpShopperProductSql;
import com.financing.wap.dao.IFpShopperProductDao;
import com.financing.wap.dto.FpShopperProductDTO;
import com.financing.wap.vo.ShopperProductVO;
/**
 * fp_shopper_product  
 * 用户店铺添加的产品 数据访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("fpShopperProductDao")
public class FpShopperProductDaoImpl extends BaseDaoImpl<FpShopperProductDTO, java.lang.Integer> implements IFpShopperProductDao {


	@Override
	public int insert(FpShopperProductDTO fpShopperProduct) throws SQLException {
		return (Integer) this.sqlMapClientTemplate.insert(SqlName.FpShopperProductSql.insert, fpShopperProduct);
	}

	@Override
	public void update(FpShopperProductDTO fpShopperProduct) throws SQLException {
		this.sqlMapClientTemplate.update(SqlName.FpShopperProductSql.update, fpShopperProduct);
	}

	@Override
	public void updateForce(FpShopperProductDTO fpShopperProduct) throws SQLException {
		this.sqlMapClientTemplate.update(SqlName.FpShopperProductSql.updateForce, fpShopperProduct);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		this.sqlMapClientTemplate.delete(SqlName.FpShopperProductSql.delete,id);
	}
	
	@SuppressWarnings("unchecked")	
	@Override
	public List<FpShopperProductDTO> queryList(FpShopperProductDTO fpShopperProduct) throws SQLException {
		return this.sqlMapClientTemplate.queryForList(SqlName.FpShopperProductSql.queryList, fpShopperProduct);
	}

	@Override
	public int queryListCount(FpShopperProductDTO fpShopperProduct) throws SQLException {
		return (Integer) this.sqlMapClientTemplate.queryForObject(SqlName.FpShopperProductSql.queryListCount, fpShopperProduct);
	}

	@Override
	public FpShopperProductDTO loadById(Integer id) throws SQLException {
		return  (FpShopperProductDTO)this.getSqlMapClientTemplate().queryForObject(SqlName.FpShopperProductSql.loadById,id);
	}

	@Override
	public Class<FpShopperProductDTO> getEntityClass() {
		return FpShopperProductDTO.class;
	}

	@Override
	public List<ShopperProductVO> queryShopperProduct(FpShopperProductDTO shop)
			throws SQLException {
		List<ShopperProductVO> projectList= this.sqlMapClientTemplate.queryForList(FpShopperProductSql.shopperProdcutList,shop);
		return projectList;
	}

	@Override
	public int queryShopperProductCount(FpShopperProductDTO shop)
			throws SQLException {
		int count= (Integer) this.sqlMapClientTemplate.queryForObject(FpShopperProductSql.shopperProdcutListCount,shop);
		return count;
	}
 	
}
